with open("text.txt","w",encoding = "utf-8") as f:
    content = f.write(
    "2023-10-1 晴" "\n"
    "今天学习了python文件！"
    )
   
    print(content)

f = open("text.txt","r",encoding = "utf-8")
res = f.read()
print(res)
f.close()

